df_aut <- read_rds("morning_after_dataset_individuallevel.rds") %>%
filter(democracy_lag == 0 & leader == 0 & !is.na(purged_y1) & !is.na(gdp_cap_pwt_ln) & !is.na(pop_pwt_ln) & leaderexperience_continuous > 1)
###
# Marginal effects ---
###
# Responsibility ---
responsibility_felm <- felm(purged_y1 ~ minister_type/coupattempt_presentyear +
gdp_cap_pwt_ln + pop_pwt_ln + experience + I(experience^2) +
I(experience^3) | country_isocode+year | 0 | country_isocode , data=df_aut) %>% summary()
coef_responsibility <- tibble(name = c("Minister of Defense","Minister of Finance","Minister of Foreign Affairs",
"Minister of Natural Resources","Other type of minister"),
estimate = c(responsibility_felm$coefficients[10],
responsibility_felm$coefficients[11],
responsibility_felm$coefficients[12],
responsibility_felm$coefficients[13],
responsibility_felm$coefficients[14]),
se = c(responsibility_felm$coefficients[10,2],
responsibility_felm$coefficients[11,2],
responsibility_felm$coefficients[12,2],
responsibility_felm$coefficients[13,2],
responsibility_felm$coefficients[14,2]
)) %>% mutate(name = fct_relevel(name,
"Minister of Natural Resources",
"Other type of minister",
"Minister of Finance",
"Minister of Foreign Affairs",
"Minister of Defense"
))
plot_resp <- plot_canvas(coef_responsibility) + ggtitle("H3a: Ministerial responsibility") + ylim(-0.2,0.5)
# Affiliation ---
df_party <- df_aut %>% filter(party_group != "unknown") %>% mutate(party_group = as.factor(recode(party_group,"independent"="No party affiliation","leader_party"="From the leader's party","other_party"="From another party")))
affiliation_felm <- felm(purged_y1 ~ party_group/coupattempt_presentyear +
gdp_cap_pwt_ln + pop_pwt_ln + experience + I(experience^2) +
I(experience^3) | country_isocode+year | 0 | country_isocode , data=df_party) %>% summary()
coef_affiliation <- tibble(name = c("From another party","From the leader's party","No party affiliation"),
estimate = c(affiliation_felm$coefficients[8],
affiliation_felm$coefficients[9],
affiliation_felm$coefficients[10]),
se = c(affiliation_felm$coefficients[8,2],
affiliation_felm$coefficients[9,2],
affiliation_felm$coefficients[10,2]
)
) %>% mutate(name = fct_relevel(name,
"From the leader's party",
"No party affiliation",
"From another party"))
plot_affiliation <- plot_canvas(coef_affiliation) + ggtitle("H2b: Affiliation") + ylim(-0.2,0.5)
# Importance ---
df_importance <- df_aut %>% filter(importance_factor != "0")
importance_felm <- felm(purged_y1 ~ importance_factor/coupattempt_presentyear +
gdp_cap_pwt_ln + pop_pwt_ln + experience + I(experience^2) +
I(experience^3) | country_isocode+year | 0 | country_isocode , data=df_importance) %>% summary()
coef_importance <- tibble(name = c("Junior minister\nor other low\nranking post","Low-ranking\nminister","Medium-ranking\nminister",
"Vice president,\ndeputy prime minister,\ntop minister","Prime minister/President\n(not leader)"),
estimate = c(importance_felm$coefficients[10],
importance_felm$coefficients[11],
importance_felm$coefficients[12],
importance_felm$coefficients[13],
importance_felm$coefficients[14]),
se = c(importance_felm$coefficients[10,2],
importance_felm$coefficients[11,2],
importance_felm$coefficients[12,2],
importance_felm$coefficients[13,2],
importance_felm$coefficients[14,2]
)
) %>% mutate(name = fct_relevel(name,
"Junior minister\nor other low\nranking post","Low-ranking\nminister","Medium-ranking\nminister",
"Vice president,\ndeputy prime minister,\ntop minister","Prime minister/President\n(not leader)"))
plot_importance <- plot_canvas(coef_importance) + ggtitle("H3b: Importance in cabinet") + ylim(-0.2,0.7)
# Experience ---
df_experience <- df_aut %>% filter(importance_factor != "0.5")
quantiles_experience <- df_aut %>% summarise(x = quantile(experience, c(0.25, 0.5, 0.75)), experience = c(0.25, 0.5, 0.75))
experience_group <- felm(purged_y1 ~ as.factor(experience_group)/coupattempt_presentyear +
gdp_cap_pwt_ln + pop_pwt_ln | country_isocode+year | 0 | country_isocode, data=df_experience) %>% summary()
coef_experience_group <- tibble(name = c("Less than 2 years","2-3 years",
"4-6 years","Over 6 years"),
estimate = c(experience_group$coefficients[6],
experience_group$coefficients[7],
experience_group$coefficients[8],
experience_group$coefficients[9]),
se = c(experience_group$coefficients[6,2],
experience_group$coefficients[7,2],
experience_group$coefficients[8,2],
experience_group$coefficients[9,2]
)) %>% mutate(name = fct_relevel(name,
"Over 6 years","4-6 years",
"2-3 years",
"Less than 2 years"
))
plot_expgroup <- plot_canvas(coef_experience_group) + ggtitle("H2a: Experience")
# Combination ---
medianbyyear <- df_experience %>% group_by(country_isocode,year) %>% summarize(experience_median = median(experience,na.rm=TRUE))
df_combination <- df_experience %>% left_join(.,medianbyyear,by=c("country_isocode","year")) %>% filter(party_group != "unknown") %>%
mutate(experience_bin = ifelse(experience >= experience_median, 1,0),
important_bin = if_else(importance_numeric %in% c(3,4),1,0),
loyal_bin = if_else(experience_bin == 1 & party_group == "leader_party",1,0),
typology = case_when(important_bin == 0 & loyal_bin == 0 ~ 1,
important_bin == 1 & loyal_bin == 0 ~ 2,
important_bin == 0 & loyal_bin == 1 ~ 3,
important_bin == 1 & loyal_bin == 1 ~ 4
)
)
combination_felm <- felm(purged_y1 ~ as.factor(typology)/coupattempt_presentyear +
gdp_cap_pwt_ln + pop_pwt_ln | country_isocode+year | 0 | country_isocode , data=df_combination) %>% summary()
coef_combination <- tibble(name = c("Low responsibility and weak signs of loyalty","High responsibility and weak signs of loyalty",
"Low responsibility and strong signs of loyalty","High responsibility and strong signs of loyalty"),
estimate = c(combination_felm$coefficients[6],
combination_felm$coefficients[7],
combination_felm$coefficients[8],
combination_felm$coefficients[9]),
se = c(combination_felm$coefficients[6,2],
combination_felm$coefficients[7,2],
combination_felm$coefficients[8,2],
combination_felm$coefficients[9,2]
)) %>% mutate(name = fct_relevel(name,
"High responsibility and strong signs of loyalty","Low responsibility and strong signs of loyalty",
"High responsibility and weak signs of loyalty","Low responsibility and weak signs of loyalty"
))
plot_combination <- plot_canvas(coef_combination) + ggtitle("H4: Combinations of traits") + ylim(-0.2,0.5)
# Get N's ---
n_exp <-  df_experience %>% filter(!is.na(coupattempt_presentyear)) %>% group_by(coupattempt_presentyear) %>% summarize(n = as.numeric(n())) %>% ungroup() %>%
mutate(sum = sum(n))
n_affliation <-  df_party %>% filter(!is.na(coupattempt_presentyear)) %>% group_by(coupattempt_presentyear) %>% summarize(n = as.numeric(n())) %>% ungroup() %>%
mutate(sum = sum(n))
n_resp <-  df_aut %>% filter(!is.na(coupattempt_presentyear) & !is.na(minister_type)) %>% group_by(coupattempt_presentyear) %>% summarize(n = as.numeric(n())) %>% ungroup() %>%
mutate(sum = sum(n))
n_importance <-  df_importance %>% filter(!is.na(coupattempt_presentyear)) %>% group_by(coupattempt_presentyear) %>% summarize(n = as.numeric(n())) %>% ungroup() %>%
mutate(sum = sum(n))
n_comb <-  df_combination %>% filter(!is.na(coupattempt_presentyear)) %>% group_by(coupattempt_presentyear) %>% summarize(n = as.numeric(n())) %>% ungroup() %>%
mutate(sum = sum(n))
###
# Print ---
###
ggsave(
'output/appendix_n1.jpg',
gridExtra::grid.arrange(plot_expgroup, plot_affiliation, plot_resp, plot_importance),
width = 10,
height = 9,
dpi = 120
)
ggsave(
'output/appendix_n2.jpg',
plot_combination,
width = 10,
height = 9,
dpi = 120
)
################
## Appendix M ##
################
####
## Set up template ---
####
pd <- position_dodge(0.75)
plot_canvas_typedem <- function(df=df,x=name,y=estimate,se=se, group = group){
ggplot(data = df, aes(y = estimate, x = name, group = group, colour = group)) +
geom_point(position = pd) +
geom_errorbar(aes(ymin = estimate-1.96*se, ymax = estimate+1.96*se),
width = 0,
position = pd,
size = 1) +
coord_flip() +
ylim(-0.2,0.5) +
labs(x = "",
y = "Marginal Effects",
color = "black") +
geom_hline(yintercept = 0,
linetype = "dashed") +
theme_bw() +
theme(panel.border = element_blank(), panel.grid.major = element_blank(),
panel.grid.minor = element_blank(), axis.line = element_line(colour = "black"),
legend.position = "bottom",plot.title = element_text(size=14),
axis.text.y = element_text(colour = "black",size=14),
axis.text.x = element_text(colour = "black",size=14),
text=element_text(family="Times",size=14,color="black")) +
scale_colour_manual(
name = "",
breaks = c("Polity IV","Bjørnskov and Rode"),
labels = c("Polity IV","Bjørnskov and Rode"),
values = c("Grey", "Black"))
}
###
# Polity ---
###
df_aut <- read_rds("morning_after_dataset_individuallevel.rds") %>% filter(lag_polity2 < 7 & leader == 0 & !is.na(purged_y1))
###
# Marginal effects ---
###
# Responsiblity ---
responsibility_felm <-  felm(purged_y1 ~ minister_type/coupattempt_presentyear +
gdp_cap_pwt_ln + pop_pwt_ln + experience + I(experience^2) +
I(experience^3) | country_isocode+year | 0 | country_isocode , data=df_aut) %>% summary()
coef_responsibility_polity <- tibble(name = c("Minister of Defense","Minister of Finance","Minister of Foreign Affairs",
"Minister of Natural Resources","Other type of minister"),
estimate = c(responsibility_felm$coefficients[10],
responsibility_felm$coefficients[11],
responsibility_felm$coefficients[12],
responsibility_felm$coefficients[13],
responsibility_felm$coefficients[14]),
se = c(responsibility_felm$coefficients[10,2],
responsibility_felm$coefficients[11,2],
responsibility_felm$coefficients[12,2],
responsibility_felm$coefficients[13,2],
responsibility_felm$coefficients[14,2]
)) %>% mutate(name = fct_relevel(name,
"Minister of Natural Resources",
"Other type of minister",
"Minister of Finance",
"Minister of Foreign Affairs",
"Minister of Defense"),
group = "Polity IV"
)
# Affiliation ---
df_party <- df_aut %>% filter(party_group != "unknown") %>% mutate(party_group = as.factor(recode(party_group,"independent"="No party affiliation","leader_party"="From the leader's party","other_party"="From another party")))
affiliation_felm <- felm(purged_y1 ~ party_group/coupattempt_presentyear +
gdp_cap_pwt_ln + pop_pwt_ln + experience + I(experience^2) +
I(experience^3) | country_isocode+year | 0 | country_isocode , data=df_party) %>% summary()
coef_affiliation_polity <- tibble(name = c("From another party","From the leader's party","No party affiliation"),
estimate = c(affiliation_felm$coefficients[8],
affiliation_felm$coefficients[9],
affiliation_felm$coefficients[10]),
se = c(affiliation_felm$coefficients[8,2],
affiliation_felm$coefficients[9,2],
affiliation_felm$coefficients[10,2]
)
) %>% mutate(name = fct_relevel(name,
"From the leader's party",
"No party affiliation",
"From another party"),
group = "Polity IV"
)
# Importance ---
df_importance <- df_aut %>% filter(importance_factor != "0")
importance_felm <- felm(purged_y1 ~ importance_factor/coupattempt_presentyear +
gdp_cap_pwt_ln + pop_pwt_ln + experience + I(experience^2) +
I(experience^3) | country_isocode+year | 0 | country_isocode , data=df_importance) %>% summary()
coef_importance_polity <- tibble(name = c("Junior minister\nor other low-\nranking post","Low-ranking\nminister","Medium-ranking\nminister",
"Vice president,\ndeputy prime minister,\ntop minister","Prime minister/President\n(not leader)"),
estimate = c(importance_felm$coefficients[10],
importance_felm$coefficients[11],
importance_felm$coefficients[12],
importance_felm$coefficients[13],
importance_felm$coefficients[14]),
se = c(importance_felm$coefficients[10],
importance_felm$coefficients[11,2],
importance_felm$coefficients[12,2],
importance_felm$coefficients[13,2],
importance_felm$coefficients[14,2]
)
) %>% mutate(name = fct_relevel(name,
"Junior minister\nor other low-\nranking post","Low-ranking\nminister","Medium-ranking\nminister",
"Vice president,\ndeputy prime minister,\ntop minister","Prime minister/President\n(not leader)"),
group = "Polity IV"
)
# Experience ---
df_experience <- df_aut %>% filter(importance_factor != "0.5")
quantiles_experience <- df_aut %>% summarise(x = quantile(experience, c(0.25, 0.5, 0.75)), experience = c(0.25, 0.5, 0.75))
experience_group <- felm(purged_y1 ~ as.factor(experience_group)/coupattempt_presentyear +
gdp_cap_pwt_ln + pop_pwt_ln | country_isocode+year | 0 | country_isocode, data=df_experience) %>% summary()
coef_experience_polity <- tibble(name = c("Less than 2 years","2-3 years",
"4-6 years","Over 6 years"),
estimate = c(experience_group$coefficients[6],
experience_group$coefficients[7],
experience_group$coefficients[8],
experience_group$coefficients[9]),
se = c(experience_group$coefficients[6,2],
experience_group$coefficients[7,2],
experience_group$coefficients[8,2],
experience_group$coefficients[9,2]
)) %>% mutate(name = fct_relevel(name,
"Over 6 years","4-6 years",
"2-3 years",
"Less than 2 years"),
group = "Polity IV"
)
# Combination ---
medianbyyear <- df_experience %>% group_by(country_isocode,year) %>% summarize(experience_median = median(experience,na.rm=TRUE))
df_combination <- df_experience %>% left_join(.,medianbyyear,by=c("country_isocode","year")) %>% filter(party_group != "unknown") %>%
mutate(experience_bin = ifelse(experience >= experience_median, 1,0),
important_bin = if_else(importance_numeric %in% c(3,4),1,0),
loyal_bin = if_else(experience_bin == 1 & party_group == "leader_party",1,0),
typology = case_when(important_bin == 0 & loyal_bin == 0 ~ 1,
important_bin == 1 & loyal_bin == 0 ~ 2,
important_bin == 0 & loyal_bin == 1 ~ 3,
important_bin == 1 & loyal_bin == 1 ~ 4
)
)
combination_felm <- felm(purged_y1 ~ as.factor(typology)/coupattempt_presentyear +
gdp_cap_pwt_ln + pop_pwt_ln | country_isocode+year | 0 | country_isocode , data=df_combination) %>% summary()
coef_combination_polity <- tibble(name = c("Low responsibility and weak signs of loyalty","High responsibility and weak signs of loyalty",
"Low responsibility and strong signs of loyalty","High responsibility and strong signs of loyalty"),
estimate = c(combination_felm$coefficients[6],
combination_felm$coefficients[7],
combination_felm$coefficients[8],
combination_felm$coefficients[9]),
se = c(combination_felm$coefficients[6,2],
combination_felm$coefficients[7,2],
combination_felm$coefficients[8,2],
combination_felm$coefficients[9,2]
)) %>% mutate(name = fct_relevel(name,
"High responsibility and strong signs of loyalty","Low responsibility and strong signs of loyalty",
"High responsibility and weak signs of loyalty","Low responsibility and weak signs of loyalty"),
group = "Polity IV"
)
# Get N's ---
n_exp <-  df_experience %>% filter(!is.na(coupattempt_presentyear)) %>% group_by(coupattempt_presentyear) %>% summarize(n = as.numeric(n())) %>% ungroup() %>%
mutate(sum = sum(n))
n_affliation <-  df_party %>% filter(!is.na(coupattempt_presentyear)) %>% group_by(coupattempt_presentyear) %>% summarize(n = as.numeric(n())) %>% ungroup() %>%
mutate(sum = sum(n))
n_resp <-  df_aut %>% filter(!is.na(coupattempt_presentyear) & !is.na(minister_type)) %>% group_by(coupattempt_presentyear) %>% summarize(n = as.numeric(n())) %>% ungroup() %>%
mutate(sum = sum(n))
n_importance <-  df_importance %>% filter(!is.na(coupattempt_presentyear)) %>% group_by(coupattempt_presentyear) %>% summarize(n = as.numeric(n())) %>% ungroup() %>%
mutate(sum = sum(n))
n_comb <-  df_combination %>% filter(!is.na(coupattempt_presentyear)) %>% group_by(coupattempt_presentyear) %>% summarize(n = as.numeric(n())) %>% ungroup() %>%
mutate(sum = sum(n))
####
# Bjørnskov and Rode ---
####
df_aut <- read_rds("morning_after_dataset_individuallevel.rds") %>% filter(democracy_lag_br == "Autocracy" & leader == 0 & !is.na(purged_y1))
###
# Marginal effects ---
###
# Responsiblity ---
responsibility_felm <-  felm(purged_y1 ~ minister_type/coupattempt_presentyear +
gdp_cap_pwt_ln + pop_pwt_ln + experience + I(experience^2) +
I(experience^3) | country_isocode+year | 0 | country_isocode , data=df_aut) %>% summary()
coef_responsibility_dd <- tibble(name = c("Minister of Defense","Minister of Finance","Minister of Foreign Affairs",
"Minister of Natural Resources","Other type of minister"),
estimate = c(responsibility_felm$coefficients[10],
responsibility_felm$coefficients[11],
responsibility_felm$coefficients[12],
responsibility_felm$coefficients[13],
responsibility_felm$coefficients[14]),
se = c(responsibility_felm$coefficients[10,2],
responsibility_felm$coefficients[11,2],
responsibility_felm$coefficients[12,2],
responsibility_felm$coefficients[13,2],
responsibility_felm$coefficients[14,2]
)) %>% mutate(name = fct_relevel(name,
"Minister of Natural Resources",
"Other type of minister",
"Minister of Finance",
"Minister of Foreign Affairs",
"Minister of Defense"),
group = "Bjørnskov and Rode"
)
coef_responsibility_both <- rbind(coef_responsibility_polity,coef_responsibility_dd)
plot_resp_both <- plot_canvas_typedem(coef_responsibility_both) + ggtitle("H3a: Ministerial responsibility")
# Affiliation ---
df_party <- df_aut %>% filter(party_group != "unknown") %>% mutate(party_group = as.factor(recode(party_group,"independent"="No party affiliation","leader_party"="From the leader's party","other_party"="From another party")))
affiliation_felm <- felm(purged_y1 ~ party_group/coupattempt_presentyear +
gdp_cap_pwt_ln + pop_pwt_ln + experience + I(experience^2) +
I(experience^3) | country_isocode+year | 0 | country_isocode , data=df_party) %>% summary()
coef_affiliation_dd <- tibble(name = c("From another party","From the leader's party","No party affiliation"),
estimate = c(affiliation_felm$coefficients[8],
affiliation_felm$coefficients[9],
affiliation_felm$coefficients[10]),
se = c(affiliation_felm$coefficients[8,2],
affiliation_felm$coefficients[9,2],
affiliation_felm$coefficients[10,2]
)
) %>% mutate(name = fct_relevel(name,
"From the leader's party",
"No party affiliation",
"From another party"),
group = "Bjørnskov and Rode"
)
coef_affiliation_both <- rbind(coef_affiliation_polity,coef_affiliation_dd)
plot_affiliation_both <- plot_canvas_typedem(coef_affiliation_both) + ggtitle("H2b: Affiliation")
# Importance ---
df_importance <- df_aut %>% filter(importance_factor != "0")
importance_felm <- felm(purged_y1 ~ importance_factor/coupattempt_presentyear +
gdp_cap_pwt_ln + pop_pwt_ln + experience + I(experience^2) +
I(experience^3) | country_isocode+year | 0 | country_isocode , data=df_importance) %>% summary()
coef_importance_dd <- tibble(name = c("Junior minister\nor other low-\nranking post","Low-ranking\nminister","Medium-ranking\nminister",
"Vice president,\ndeputy prime minister,\ntop minister","Prime minister/President\n(not leader)"),
estimate = c(importance_felm$coefficients[10],
importance_felm$coefficients[11],
importance_felm$coefficients[12],
importance_felm$coefficients[13],
importance_felm$coefficients[14]),
se = c(importance_felm$coefficients[10],
importance_felm$coefficients[11,2],
importance_felm$coefficients[12,2],
importance_felm$coefficients[13,2],
importance_felm$coefficients[14,2]
)
) %>% mutate(name = fct_relevel(name,
"Junior minister\nor other low-\nranking post","Low-ranking\nminister","Medium-ranking\nminister",
"Vice president,\ndeputy prime minister,\ntop minister","Prime minister/President\n(not leader)"),
group = "Bjørnskov and Rode"
)
coef_importance_both <- rbind(coef_importance_polity,coef_importance_dd)
plot_importance_both <- plot_canvas_typedem(coef_importance_both) + ggtitle("H3b: Importance in cabinet") + ylim(-0.1,0.7)
# Experience ---
df_experience <- df_aut %>% filter(importance_factor != "0.5")
quantiles_experience <- df_aut %>% summarise(x = quantile(experience, c(0.25, 0.5, 0.75)), experience = c(0.25, 0.5, 0.75))
experience_group <- felm(purged_y1 ~ as.factor(experience_group)/coupattempt_presentyear +
gdp_cap_pwt_ln + pop_pwt_ln | country_isocode+year | 0 | country_isocode, data=df_experience) %>% summary()
coef_experience_dd <- tibble(name = c("Less than 2 years","2-3 years",
"4-6 years","Over 6 years"),
estimate = c(experience_group$coefficients[6],
experience_group$coefficients[7],
experience_group$coefficients[8],
experience_group$coefficients[9]),
se = c(experience_group$coefficients[6,2],
experience_group$coefficients[7,2],
experience_group$coefficients[8,2],
experience_group$coefficients[9,2]
)) %>% mutate(name = fct_relevel(name,
"Over 6 years","4-6 years",
"2-3 years",
"Less than 2 years"),
group = "Bjørnskov and Rode"
)
coef_experience_both <- rbind(coef_experience_polity,coef_experience_dd)
plot_expgroup_both <- plot_canvas_typedem(coef_experience_both) + ggtitle("H2a: Experience")
# Combination ---
medianbyyear <- df_experience %>% group_by(country_isocode,year) %>% summarize(experience_median = median(experience,na.rm=TRUE))
df_combination <- df_experience %>% left_join(.,medianbyyear,by=c("country_isocode","year")) %>% filter(party_group != "unknown") %>%
mutate(experience_bin = ifelse(experience >= experience_median, 1,0),
important_bin = if_else(importance_numeric %in% c(3,4),1,0),
loyal_bin = if_else(experience_bin == 1 & party_group == "leader_party",1,0),
typology = case_when(important_bin == 0 & loyal_bin == 0 ~ 1,
important_bin == 1 & loyal_bin == 0 ~ 2,
important_bin == 0 & loyal_bin == 1 ~ 3,
important_bin == 1 & loyal_bin == 1 ~ 4
)
)
combination_felm <- felm(purged_y1 ~ as.factor(typology)/coupattempt_presentyear +
gdp_cap_pwt_ln + pop_pwt_ln | country_isocode+year | 0 | country_isocode , data=df_combination) %>% summary()
coef_combination_dd <- tibble(name = c("Low responsibility and weak signs of loyalty","High responsibility and weak signs of loyalty",
"Low responsibility and strong signs of loyalty","High responsibility and strong signs of loyalty"),
estimate = c(combination_felm$coefficients[6],
combination_felm$coefficients[7],
combination_felm$coefficients[8],
combination_felm$coefficients[9]),
se = c(combination_felm$coefficients[6,2],
combination_felm$coefficients[7,2],
combination_felm$coefficients[8,2],
combination_felm$coefficients[9,2]
)) %>% mutate(name = fct_relevel(name,
"High responsibility and strong signs of loyalty","Low responsibility and strong signs of loyalty",
"High responsibility and weak signs of loyalty","Low responsibility and weak signs of loyalty"),
group = "Bjørnskov and Rode"
)
coef_combination_both <- rbind(coef_combination_polity,coef_combination_dd)
plot_combination_both <- plot_canvas_typedem(coef_combination_both) + ggtitle("H4: Combinations of traits")
# Get N's ---
n_exp <-  df_experience %>% filter(!is.na(coupattempt_presentyear)) %>% group_by(coupattempt_presentyear) %>% summarize(n = as.numeric(n())) %>% ungroup() %>%
mutate(sum = sum(n))
n_affliation <-  df_party %>% filter(!is.na(coupattempt_presentyear)) %>% group_by(coupattempt_presentyear) %>% summarize(n = as.numeric(n())) %>% ungroup() %>%
mutate(sum = sum(n))
n_resp <-  df_aut %>% filter(!is.na(coupattempt_presentyear) & !is.na(minister_type)) %>% group_by(coupattempt_presentyear) %>% summarize(n = as.numeric(n())) %>% ungroup() %>%
mutate(sum = sum(n))
n_importance <-  df_importance %>% filter(!is.na(coupattempt_presentyear)) %>% group_by(coupattempt_presentyear) %>% summarize(n = as.numeric(n())) %>% ungroup() %>%
mutate(sum = sum(n))
n_comb <-  df_combination %>% filter(!is.na(coupattempt_presentyear)) %>% group_by(coupattempt_presentyear) %>% summarize(n = as.numeric(n())) %>% ungroup() %>%
mutate(sum = sum(n))
###
# Print ---
###
ggsave(
'output/appendix_m1.jpg',
gridExtra::grid.arrange(plot_expgroup_both, plot_affiliation_both, plot_resp_both, plot_importance_both),
width = 11,
height = 10,
dpi = 120
)
ggsave(
'output/appendix_m2.jpg',
plot_combination_both,
width = 11,
height = 10,
dpi = 120
)
View(logger)
logger
windowsFonts(Times=windowsFont("Times New Roman"))
pacman::p_load(tidyverse,texreg,haven,lfe)
df_figure1 <- read_dta("morning_after_dataset_countrylevel.dta") %>%
filter(democracy1==0 & independent==1 & !is.na(coupattempt_whogov) & !is.na(replacement_rateadj_minister)) %>%
mutate(coupattempt_whogov = as.factor(coupattempt_whogov),
coupattempt_whogov = recode(coupattempt_whogov,"1" = "Failed coup attempt","0" = "No failed coup attempt")) %>%
select(coupattempt_whogov,replacement_rateadj_minister)
figure_1 <- ggplot(df_figure1, aes(x=coupattempt_whogov, y=replacement_rateadj_minister)) +
geom_violin(fill='#cccccc',alpha=0.8) +
theme_bw() +
theme(panel.border = element_blank(), panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),axis.title.y=element_text(size=16,angle=0,vjust=1),
axis.text=element_text(size=16),
text=element_text(family="Times")) +
ylab("Replacement\nrates") +
xlab("") +
geom_boxplot(width=0.1)
figure_1
df_figure1 <- read_dta("morning_after_dataset_countrylevel.dta") %>%
filter(democracy1==0 & independent==1 & !is.na(coupattempt_whogov) & !is.na(replacement_rateadj_minister)) %>%
mutate(coupattempt_whogov = as.factor(coupattempt_whogov),
coupattempt_whogov = recode(coupattempt_whogov,"1" = "Failed coup attempt","0" = "No failed coup attempt")) %>%
dplyr::select(coupattempt_whogov,replacement_rateadj_minister)
figure_1 <- ggplot(df_figure1, aes(x=coupattempt_whogov, y=replacement_rateadj_minister)) +
geom_violin(fill='#cccccc',alpha=0.8) +
theme_bw() +
theme(panel.border = element_blank(), panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),axis.title.y=element_text(size=16,angle=0,vjust=1),
axis.text=element_text(size=16),
text=element_text(family="Times")) +
ylab("Replacement\nrates") +
xlab("") +
geom_boxplot(width=0.1)
mean_violin <- df_figure1 %>% group_by(coupattempt_whogov) %>% summarize(median = median(replacement_rateadj_minister,na.rm=TRUE),n = n())
